1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.geronimo.ews.ws4j2ee.toWs;
18
19 import org.apache.geronimo.ews.ws4j2ee.context.J2EEWebServiceContext;
20 import org.apache.geronimo.ews.ws4j2ee.utils.Utils;
21
22 /***
23 * abstract class writer
24 *
25 * @author Srianth Perera(hemapani@opensource.lk)
26 */
27 public abstract class JavaClassWriter extends AbstractWriter {
28 protected String qulifiedName;
29 protected String classname;
30 protected String packageName/package-summary.html">ong> String packageName;
31 private String pacakgesatement;
32 private String targetDirectory;
33
34 public JavaClassWriter(J2EEWebServiceContext j2eewscontext, String qulifiedName) throws GenerationFault {
35 super(j2eewscontext, Utils.getFileNamefromClass(j2eewscontext, qulifiedName));
36 this.qulifiedName = qulifiedName;
37 packageName = Utils.getPackageNameFromQuallifiedName(qulifiedName);
38 classname = Utils.getClassNameFromQuallifiedName(qulifiedName);
39 }
40
41 public void writeCode() throws GenerationFault {
42 if (out == null)
43 return;
44 out.write((packageName != null) ? ("package " + packageName + ";\n") : "");
45 writeImportStatements();
46 writeClassComment();
47 out.write("public class "
48 + classname
49 + getExtendsPart()
50 + getimplementsPart()
51 + "{\n");
52 writeAttributes();
53 writeConstructors();
54 writeMethods();
55 out.write("}\n");
56 }
57
58 protected String getExtendsPart() {
59 return " ";
60 }
61
62 protected String getimplementsPart() {
63 return " ";
64 }
65
66 protected void writeClassComment() throws GenerationFault {
67 }
68
69 protected void writeImportStatements() throws GenerationFault {
70 }
71
72 protected abstract void writeAttributes() throws GenerationFault;
73
74 protected abstract void writeConstructors() throws GenerationFault;
75
76 protected abstract void writeMethods() throws GenerationFault;
77 }